import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/login',
    alias: '/',
    component: () => import('@/views/login/login.vue')
  },
  {
    path: '/home',
    component: () => import('@/views/home/home.vue'),
    redirect: '/home/my',
    children: [
      {
        path: '/home/homepage',
        component: () => import('@/views/home/homepage/homepage.vue'),
        meta: {
          needTab: true
        }
      },
      {
        path: '/home/questions',
        component: () => import('@/views/home/questions/questions.vue'),
        meta: {
          needTab: true
        }
      },
      {
        path: '/home/result/:q?',
        component: () => import('@/views/home/questions/result.vue'),
        meta: {
          needTab: false
        }
      },
      {
        path: '/home/article',
        component: () => import('@/views/home/article/article.vue')
      },
      {
        path: '/home/my',
        component: () => import('@/views/home/my/my.vue'),
        meta: {
          needTab: true
        }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
